<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
</head> 

<body>
    <input type="text" id="txt1">
    <select  id="select">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" id="txt2">
    <input type="button" value="=" onclick="count()">
    <input type="text" id="fruit">

    <script>
        function count(){
            var a = document.getElementById("txt1").value;
            // 获取第一个输入框的值
            var b = document.getElementById("txt2").value;
            // 获取第二个输入框的值
            var c = document.getElementById("select").value;
            // 获取选择框的值
            a = parseFloat(a);
            b=parseFloat(b);
            switch(c){
                case "+":
                document.getElementById("fruit").value=parseInt(a)+parseInt(b);
                break;

                case "-":
                document.getElementById("fruit").value=parseInt(a)-parseInt(b);
                break;

                case "*":
                document.getElementById("fruit").value=parseInt(a)*parseInt(b);
                break;

                case "/":
                document.getElementById("fruit").value=parseInt(a)/parseInt(b);
                break;
            }
        }
    </script>
</body>
</html>